<me:UIEXORD x:Class="WPFExcelReport.TEXORDLIST"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                     xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                     x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIEXORD.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby1440  x:Key="day"/>
        <ucd:Divideby480  x:Key="shift"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:TIMES100  x:Key="X100"/>
        <ucd:TIMES10  x:Key="X10"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PreisConverter  x:Key="PreisConverter"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
    </me:UIEXORD.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition> 
        </Grid.RowDefinitions>
        <StackPanel>
            <WrapPanel Grid.Row="0"  Margin="20,20,20,20">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto">
                        </ColumnDefinition>
                        <ColumnDefinition Width="Auto">
                        </ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="{Binding Source={Localization:Translate Word=LoadLocalDB}}"></TextBlock>
                    <Button Grid.Column="1" Width="40" Height="40" Margin="20,0,0,0" Click="Load_Click" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Refresh.png" />
                        </Button.Background>
                    </Button>
                </Grid>

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"  Margin="20,0,0,0" 
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="{Binding Source={Localization:Translate Word=LFD}}" Visibility="Collapsed"></TextBlock>
                    <TextBox Grid.Column="1"  Margin="20,0,0,0"  Name="txtLFD" CharacterCasing="Upper"  Width="40" Height="30" Visibility="Collapsed"></TextBox>

                    <Label Grid.Column="0" Content="{Binding Source={Localization:Translate Word=Brand: }}" VerticalContentAlignment="Center"></Label>
                    <TextBox Grid.Column="1" Name="txtBrand" Width="120" FontSize="18" VerticalAlignment="Center" ></TextBox>
                </Grid>
                 
                    <TextBlock Grid.Column="0"  Margin="20,0,0,0" 
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="{Binding Source={Localization:Translate Word=Article}}"></TextBlock>
                    <TextBox Grid.Column="1"  Margin="20,0,0,0"  Name="txtART" CharacterCasing="Upper"  Width="100" Height="30"></TextBox>
                    <Label Grid.Column="0" Content="{Binding Source={Localization:Translate Word=Buyer Name: }}" VerticalContentAlignment="Center"></Label>
                    <TextBox Grid.Column="1" Name="txtBuyerName" Width="120" FontSize="18" VerticalAlignment="Center" ></TextBox>
               
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto">
                        </ColumnDefinition>
                        <ColumnDefinition Width="Auto">
                        </ColumnDefinition>
                        <ColumnDefinition Width="Auto">
                        </ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"  Margin="20,0,0,0" 
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="{Binding Source={Localization:Translate Word=EntryDate}}" Visibility="Collapsed"></TextBlock>
                    <ComboBox Grid.Column="1"  IsEditable="True" Name="cmbNDate" Width="100" Height="30" Visibility="Collapsed"></ComboBox>
                    <Label Grid.Column="0" Content="{Binding Source={Localization:Translate Word=Barcode}}" VerticalContentAlignment="Center"/>
                    <TextBox Grid.Column="1" Name="txtBarcode" Width="120" FontSize="18" VerticalAlignment="Center" />                    
                </Grid>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Margin="20,0,0,0"  Width="30" Height="30" Click="btnFilter_Click">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                    <Button Grid.Column="1"   Click="btnFilterClear_Click">Clear</Button>
                </Grid>
              
            </WrapPanel>
            <WrapPanel>
                <Label Margin="10,0,0,0" Content="{Binding Source={Localization:Translate Word=Selection List1}}" VerticalContentAlignment="Center"></Label>
                <DR:TDRAUFTR Name="cDR1" Visibility="Collapsed"
                             DocType="AFSEXAPP1"   
                             PrintType="OpenExcel"
                             />
                <Button FontSize="18" Height="30" Width="30" Margin="5,0,0,0" Name="btnPrint1" Click="PrintCommand1" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Print.png" />
                    </Button.Background>
                </Button>
                <Label Margin="10,0,0,0" Content="{Binding Source={Localization:Translate Word=Selection List2}}" VerticalContentAlignment="Center"></Label>
                <DR:TDRAUFTR Name="cDR2" Visibility="Collapsed"
                        DocType="AFSEXAPP"  
                         PrintType="OpenExcel"
                         />
                <Button FontSize="18" Height="30" Width="30" Margin="5,0,0,0"  Click="PrintCommand2">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Print.png" />
                    </Button.Background>
                </Button>
                <Label Margin="10,0,0,0" Content="{Binding Source={Localization:Translate Word=Selection List3}}" VerticalContentAlignment="Center"></Label>
                <DR:TDRAUFTR Name="cDR3" Visibility="Collapsed"
                             DocType="AFSEXAPP3"   
                             PrintType="OpenExcel"
                             />
                <Button FontSize="18" Height="30" Width="30" Margin="5,0,0,0"   Click="PrintCommand3">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Print.png" />
                    </Button.Background>
                </Button>
            </WrapPanel>
            <WrapPanel Margin="20,20,20,20">
                <TextBox Text="{Binding KRS,ElementName=TV}" Width="40"/>
                <Button Grid.Column="1" Width="40" Height="40" Margin="20,0,0,0" Click="UploadCommand" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Upload.png" />
                    </Button.Background>
                </Button>
                <Button Grid.Column="1" Width="40" Height="40" Margin="20,0,0,0" Click="DownloadCommand" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/download.png" />
                    </Button.Background>
                </Button>
                <Button Grid.Column="1"   Height="40" Margin="20,0,0,0" Click="Export2PrintArticleCommand" Content="Export2PrintLabel" >
                  
                </Button>
            </WrapPanel>
            <WrapPanel Margin="20,20,20,20"  VerticalAlignment="Top">
                <Grid Margin="0,0,0,0"  VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,Converter={StaticResource nbv}}"  VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="EditCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,Converter={StaticResource bv}}"  VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,Converter={StaticResource bv}}" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="200"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock FontSize="18" Grid.Column="0" Text="{Binding Source={Localization:Translate Word=Article: Input and Enter}}"></TextBlock>
                    <ex:TXT72  FontSize="18" Grid.Column="1"  CharacterCasing="Upper" KeyUp="txtNArt_KeyUp" 
                               IsAutoEnter="False" Text="{Binding ART,ElementName=TV}"
                               Width="200" MaxLength="50" ></ex:TXT72>
                </Grid>
            </WrapPanel>
        </StackPanel>
        
        <DataGrid Grid.Row="1"
                  VerticalAlignment="Top"  
                  AutoGenerateColumns="False"
                  EnableRowVirtualization="False"
                  VerticalScrollBarVisibility="Auto"
                  HorizontalScrollBarVisibility="Auto"
                  HeadersVisibility="Column"                 
                  HorizontalAlignment="Stretch"   
                  Name="dlgMaster"
                  ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}"                                 
                  Margin="0,0,0,0"             
                  RowDetailsVisibilityMode="Visible" 
                  >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=CUSTOMER}" Header="Brand"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ROWNID}" Header="ROWNID"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VKPNEUTIME}" Header="EntryDate"  Width="Auto" />                
                <DataGridTextColumn Binding="{Binding Path=VKPART}" Header="BarCode"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VKPARTDES}" Header="Article NO"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=REMARK}" Header="Customer Remark"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=COMPOSITION}" Header="Composition"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=TWIDTH,Converter={StaticResource gb2312}}" Header="Width"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSQM}" Header="Weight"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VKPCDES}" Header="Remark"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=PRICE}" Header="Customerprice"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CHAR1}" Header="Code"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CHAR2}" Header="Book"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CHAR3}" Header="Location"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CHAR4}" Header="Supplier"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CHAR5}" Header="Buyer Name"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  > 
    </Grid>
</me:UIEXORD> 
 
